import React from 'react'
// ===================================================================== Temp
import Table from '#cpt/temp/Table'
import TableControls from '#cpt/temp/TableControls'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// ===================================================================== private component
const Box = $Lazy.load(()=>import('#tp/box/box'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
	}
	
	// 关联表单
	cols = [
		{ title: '条码号', 	dataIndex: 'spec_code',			...$fn.table.spec_code	 },
		{ title: '医院', 	dataIndex: 'hosp_name', 		width:150 },
		{ title: '姓名', 	dataIndex: 'patient_name',  	...$fn.table.name  },
		{ title: '性别', 	dataIndex: 'sex_name',  		...$fn.table.sex  },
		{ title: '科室', 	dataIndex: 'department_name',  	width:100  },
		TableControls.controls.call(this,{ width: 100 })
	]
	// 表格操作按钮
	table_controls = ({uuid, show_btn}) => {
		return [
			+show_btn === 1 ? TableControls.click.call(this,'删除',()=> {				
				let data = this.state.data.filter(item => item.uuid !== uuid)	
				this.setState({data})
			}) : null	
		]
	}

	render(){
		return (
			<>
				{/* 批量条码 */}
				<Box title="批量条码"  className='mt5' flex contentClassName='rel fv pt10 p'>
				    { Table.call(this, { wrapClassName: 'xmlr' }) }
				</Box>
			</>
		)
	}
}

export default Index